﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using EnvDTE;
using Process = System.Diagnostics.Process;
using System.Diagnostics;
using System.IO;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.VSHelp;
using Microsoft.VisualStudio.Designer.Interfaces;
using FilePropertyExtensions;

namespace ServicePackageLogger
{
    public static class Logger
    {
        public static void LogCommandInfo(Command cmd)
        {
            var output = new FileInfo(@"C:\Users\u164225\Documents\SolutionFramework\Documentation\12. Miscellaneous\Commands.txt");
            var writer = output.AppendText();

            writer.WriteLine(string.Format("{0}\t{1}\t0x{2:x}", cmd.Guid, cmd.Name, cmd.ID));

            writer.Flush();

            writer.Close();
        }

        public static void LogWindowInfo(IntPtr pAddress, IVsWindowFrame frame)
        {
            var caption = (object)null;
            var type = (object)null;
            var frameType = string.Empty;

            frame.GetProperty((int) __VSFPROPID.VSFPROPID_Caption, out caption);
            frame.GetProperty((int)__VSFPROPID.VSFPROPID_Type, out type);

            switch ((int)type)
            {
                case 1:
                    frameType = "Document Frame";
                    break;
                case 2:
                    frameType = "Tool Frame";
                    break;
                default:
                    frameType = "Unknown";
                    break;
            }

            var vTableAddress = Marshal.ReadInt32(pAddress);
            var module = Process.GetCurrentProcess().Modules.Cast<ProcessModule>().OrderBy(m => m.BaseAddress.ToInt32()).SingleOrDefault(m =>
            {
                var startAddress = m.BaseAddress.ToInt32();
                var endAddress = m.BaseAddress.ToInt32() + m.ModuleMemorySize;

                if (vTableAddress > startAddress && vTableAddress < endAddress)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            });

            if (module != null)
            {
                var output = new FileInfo(@"C:\Users\u164225\Documents\SolutionFramework\Documentation\12. Miscellaneous\Windows.txt");
                var writer = output.AppendText();
                var fileInfo = new FileInfo(module.FileName);
                var description = fileInfo.GetProperty("File description");

                writer.WriteLine(string.Format("{0}\t{1}\t{2}\t{3}\t{4}", caption, frameType, module.ModuleName, description, module.FileName));

                writer.Flush();

                writer.Close();
            }
            else
            {
                var output = new FileInfo(@"C:\Users\u164225\Documents\SolutionFramework\Documentation\12. Miscellaneous\Windows.txt");
                var writer = output.AppendText();

                writer.WriteLine(string.Format("{0}\t{1}", caption, frameType));

                writer.Flush();

                writer.Close();
            }
        }

        private static void LogServiceInfo(IntPtr pAddress, Guid serviceGuid, string serviceString)
        {
            var vTableAddress = Marshal.ReadInt32(pAddress);
            var module = Process.GetCurrentProcess().Modules.Cast<ProcessModule>().OrderBy(m => m.BaseAddress.ToInt32()).SingleOrDefault(m =>
            {
                var startAddress = m.BaseAddress.ToInt32();
                var endAddress = m.BaseAddress.ToInt32() + m.ModuleMemorySize;

                if (vTableAddress > startAddress && vTableAddress < endAddress)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            });

            if (module != null)
            {
                var output = new FileInfo(@"C:\Users\u164225\Documents\SolutionFramework\Documentation\12. Miscellaneous\ServiceLocations.txt");
                var writer = output.AppendText();
                var fileInfo = new FileInfo(module.FileName);
                var description = fileInfo.GetProperty("File description");

                writer.WriteLine(string.Format("{0}\t{1}\t{2}\t{3}\t{4}", module.ModuleName, description, serviceString, serviceGuid.ToString(), module.FileName));

                writer.Flush();

                writer.Close();
            }
        }

        private static void LogServiceError(int hr, Guid serviceGuid, string serviceString)
        {
            var output = new FileInfo(@"C:\Users\u164225\Documents\SolutionFramework\Documentation\12. Miscellaneous\ServiceErrors.txt");
            var writer = output.AppendText();
            var error = Marshal.GetExceptionForHR(hr).Message;

            writer.WriteLine(string.Format("{0}\t{1}\t{2}", serviceString, serviceGuid.ToString(), error));

            writer.Flush();

            writer.Close();
        }

        private static void LogPackageInfo(IntPtr pAddress, Guid packageGuid, string packageString)
        {
            var vTableAddress = Marshal.ReadInt32(pAddress);
            var module = Process.GetCurrentProcess().Modules.Cast<ProcessModule>().OrderBy(m => m.BaseAddress.ToInt32()).SingleOrDefault(m =>
            {
                var startAddress = m.BaseAddress.ToInt32();
                var endAddress = m.BaseAddress.ToInt32() + m.ModuleMemorySize;

                if (vTableAddress > startAddress && vTableAddress < endAddress)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            });

            if (module != null)
            {
                var output = new FileInfo(@"C:\Users\u164225\Documents\SolutionFramework\Documentation\12. Miscellaneous\PackageLocations.txt");
                var writer = output.AppendText();
                var fileInfo = new FileInfo(module.FileName);
                var description = fileInfo.GetProperty("File description");

                writer.WriteLine(string.Format("{0}\t{1}\t{2}\t{3}\t{4}", module.ModuleName, description, packageString, packageGuid.ToString(), module.FileName));

                writer.Flush();

                writer.Close();
            }
        }

        private static void LogPackageError(int hr, Guid packageGuid, string packageString)
        {
            var output = new FileInfo(@"C:\Users\u164225\Documents\SolutionFramework\Documentation\12. Miscellaneous\PackageErrors.txt");
            var writer = output.AppendText();
            var error = Marshal.GetExceptionForHR(hr).Message;

            writer.WriteLine(string.Format("{0}\t{1}\t{2}", packageString, packageGuid.ToString(), error));

            writer.Flush();

            writer.Close();
        }

        private static void LogPackageError(string error, Guid packageGuid, string packageString)
        {
            var output = new FileInfo(@"C:\Users\u164225\Documents\SolutionFramework\Documentation\12. Miscellaneous\PackageErrors.txt");
            var writer = output.AppendText();

            writer.WriteLine(string.Format("{0}\t{1}\t{2}", packageString, packageGuid.ToString(), error));

            writer.Flush();

            writer.Close();
        }

        public static void LogPackages(System.IServiceProvider provider)
        {
            var shell = (IVsShell)provider.GetService(typeof(IVsShell));
            var package = (IVsPackage)null;
            var hr = 0;
            var pUnk = IntPtr.Zero;
            var packageGuid = Guid.Empty;
            var packageName = string.Empty;

            packageGuid = new Guid("1D76B2E0-F11B-11D2-AFC3-00105A9991EF");
            packageName = "Undo Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("DA9FB551-C724-11d0-AE1F-00A0C90FFFC3");
            packageName = "Visual Studio Environment Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("44E07B02-29A5-11D3-B882-00C04F79F802");
            packageName = "Visual Studio Commands Definition Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("5010C52F-44AB-4051-8CE1-D36C20D989B4");
            packageName = "Visual Studio Directory Listing Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("6E87CFAD-6C05-4ADF-9CD7-3B7943875B7C");
            packageName = "Visual Studio Common IDE Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("715F10EB-9E99-11D2-BFC2-00C04F990235");
            packageName = "Visual Studio Environment Menu Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("ED8979BC-B02F-4dA9-A667-D3256C36220A");
            packageName = "Visual Studio COM+ Library Manager Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("53544C4D-E3F8-4AA0-8195-8A8D16019423");
            packageName = "Visual Studio Source Control Integration Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("282BD676-8B5B-11D0-8A34-00A0C91E2ACD");
            packageName = "Visual Studio Solution Build Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("F5E7E720-1401-11d1-883B-0000F87579D2");
            packageName = "Text Management Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("F74C5077-D848-4630-80C9-B00E68A1CA0C");
            packageName = "Visual Studio VsSettings Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("4A791146-19E4-11D3-B86B-00C04F79F802");
            packageName = "Visual Studio Help Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("4A9B7E50-AA16-11D0-A8C5-00A0C921A4D2");
            packageName = "Visual Studio Task List Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("A659F1B3-AD34-11D1-ABAD-0080C7B89C95");
            packageName = "Visual Studio Macros Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("21AF45B0-FFA5-11D0-B63F-00A0C922E851");
            packageName = "Class Outline Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("2C298B35-07DA-45F1-96A3-BE55D91C8d7A");
            packageName = "Microsoft.VisualStudio.IDE";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("36839529-3AF3-47FA-8194-F4A3FA9F0ED7");
            packageName = "ToolBox Control Installer Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("019971D6-4685-11D2-B48A-0000F87572EB");
            packageName = "Visual Basic Compiler Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("349C5850-65DF-11DA-9384-00065B846F21");
            packageName = "Microsoft.VisualStudio.Web";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("39C9C826-8EF8-4079-8C95-428F5B1C323F");
            packageName = "Visual Web Developer Project";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("8FF02D1A-C177-4AC8-A62F-88FC6EA65F57");
            packageName = "Visual Web Developer Project Persistence Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("C1DAB116-2D63-493A-B970-10D7DD0B476E");
            packageName = "Visual Web Developer Web Migration Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("E7f851C8-6267-4794-B0FE-7BCAB6DACBB4");
            packageName = "Visual Web Developer Web Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("DC7F691A-91FC-4F7B-923E-FE829C3A18DC");
            packageName = "Visual Web Developer Web";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("1B437D20-F8FE-11D2-A6AE-00104BCC7269");
            packageName = "Visual Studio HTM Editor Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("BFCC0C3C-6F87-4285-A6C8-BB616061800D");
            packageName = "Visual Web Developer HTML Source Editor Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("A764E895-518D-11d2-9A89-00C04F79EFC3");
            packageName = "Visual Studio CSS Editing Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("87569308-4813-40A0-9CD0-D7A30838CA3F");
            packageName = "Visual Studio XML Editor Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("E8B06F41-6D01-11D2-AA7D-00C04F990343");
            packageName = "Visual Studio Web Browser Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("5B98C2C0-CD7B-11D0-92DF-00A0C9138C45");
            packageName = "Visual Studio Binary Editor Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("68939055-38E0-4D17-92CB-8909710D8178");
            packageName = "Windows Forms Designer Hosting Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("7494682B-37A0-11D2-A273-00C04F8EF4FF");
            packageName = "Windows Forms Designer Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("7B5D447B-0B12-41EA-A84E-C822034422D4");
            packageName = "Windows Forms Designer Resources Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("80C7728B-70A6-4528-8669-73E02D1B9C41");
            packageName = "Windows Forms Application Configuration Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("7EAB3C71-59FF-4571-A5F3-643F255FC2E6");
            packageName = "ElementHost Designer Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("C9DD4A57-47FB-11D2-83E7-00C04F9902C1");
            packageName = "Visual Studio Debugger";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("220A4C17-7E7C-4663-BBCC-5E607C6543CD");
            packageName = "Visual Database Tools Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("EF828E39-70F5-4b8e-A3A0-4C0ECD28A69A");
            packageName = "Visual Studio Database Tools Designers";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("D6C919AA-1217-41E2-a13B-9B92E1866305");
            packageName = "Visual Studio Data Designers";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("E1AA7737-69BE-43d0-A425-E3097651E192");
            packageName = "Visual Studio Data Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("A8F602E2-40CE-4dAF-AE82-A457A91728B9");
            packageName = "Visual Studio Data Designer Extensibility Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B");
            packageName = "Visual Studio Explorers and";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("F3A96850-E2AE-4E00-9278-8FE23F225A0D");
            packageName = "Microsoft Report Designer";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("B65E9356-A4C7-4855-96BB-1D3EC8514E8F");
            packageName = "Microsoft.VisualStudio.Data.Providers.";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("C8AFB2F4-BFF7-4055-926D-D44AFECD5832");
            packageName = "Microsoft.VisualStudio.DataDesign.";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("D1091694-EA72-4BDD-8918-78324CC25448");
            packageName = "Microsoft.VisualStudio.Modeling.Shell.";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("A9696DE6-E209-414D-BBEC-A0506fb0E924");
            packageName = "Microsoft.VisualStudio.TextTemplating.";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("AA8EB8CD-7A51-11D0-92C3-00A0C9138C45");
            packageName = "Visual SourceSafe Provider Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("53544C4D-B03D-4209-A7D0-D9DD13A4019B");
            packageName = "Visual SourceSafe Provider Stub Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("B3BAE735-386C-4030-8329-EF48EEDA4036");
            packageName = "Microsoft.VisualStudio.Internal.";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("E58C2A8B-BCC4-4559-AD59-D62EB6D58A22");
            packageName = "Microsoft.VisualStudio.Xaml";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("0B680757-2C29-4531-80FA-535A5178AA98");
            packageName = "Visual Studio Code Snippets Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("588205E0-66e0-11D3-8600-00C04F6123B3");
            packageName = "Visual Studio Component Enumerator";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("67909B06-91E9-4F3E-AB50-495046BE9A9A");
            packageName = "Visual Studio Settings and Project Designers Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }

            packageGuid = new Guid("F1E4CFCA-4573-4345-8718-7BDE2b1F0BE8");
            packageName = "Export Template Package";

            try
            {
                hr = shell.LoadPackage(packageGuid, out package);

                if (hr == VSConstants.S_OK)
                {
                    pUnk = Marshal.GetIUnknownForObject(package);
                    LogPackageInfo(pUnk, packageGuid, packageName);
                }
                else
                {
                    LogPackageError(hr, packageGuid, packageName);
                }
            }
            catch (Exception ex)
            {
                LogPackageError(ex.Message, packageGuid, packageName);
            }


        }

        public static void LogServices(System.IServiceProvider provider)
        {
            var serviceProvider = (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)provider.GetService(typeof(Microsoft.VisualStudio.OLE.Interop.IServiceProvider));

            #region ServiceTests

            var pUnk = IntPtr.Zero;
            var hr = 0;

            hr = serviceProvider.QueryService(typeof(SVsUIShellOpenDocument).GUID, typeof(IVsUIShellOpenDocument).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsUIShellOpenDocument).GUID, "SVsRunningDocumentTable");
            }
            else
            {
                LogServiceError(hr, typeof(SVsRunningDocumentTable).GUID, "SVsRunningDocumentTable");
            }

            hr = serviceProvider.QueryService(typeof(SBindHost).GUID, typeof(IBindHost).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SBindHost).GUID, "SBindHost");
            }
            else
            {
                LogServiceError(hr, typeof(SBindHost).GUID, "SBindHost");
            }

            hr = serviceProvider.QueryService(typeof(SDTE).GUID, typeof(DTE).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SDTE).GUID, "SDTE");
            }
            else
            {
                LogServiceError(hr, typeof(SDTE).GUID, "SDTE");
            }

            hr = serviceProvider.QueryService(typeof(SCodeNavigate).GUID, typeof(ICodeNavigate).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SCodeNavigate).GUID, "SCodeNavigate");
            }
            else
            {
                LogServiceError(hr, typeof(SCodeNavigate).GUID, "SCodeNavigate");
            }

            hr = serviceProvider.QueryService(typeof(SContainerDispatch).GUID, VSConstants.IID_IUnknown, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SContainerDispatch).GUID, "SContainerDispatch");
            }
            else
            {
                LogServiceError(hr, typeof(SContainerDispatch).GUID, "SContainerDispatch");
            }

            hr = serviceProvider.QueryService(typeof(SExtendedTypeLib).GUID, typeof(IExtendedTypeLib).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SExtendedTypeLib).GUID, "SExtendedTypeLib");
            }
            else
            {
                LogServiceError(hr, typeof(SExtendedTypeLib).GUID, "SExtendedTypeLib");
            }

            hr = serviceProvider.QueryService(typeof(SDirList).GUID, typeof(IDirList).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SDirList).GUID, "SDirList");
            }
            else
            {
                LogServiceError(hr, typeof(SDirList).GUID, "SDirList");
            }

            hr = serviceProvider.QueryService(typeof(SIVsPackageDynamicToolOwner).GUID, typeof(IVsPackageDynamicToolOwner).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SIVsPackageDynamicToolOwner).GUID, "SIVsPackageDynamicToolOwner");
            }
            else
            {
                LogServiceError(hr, typeof(SIVsPackageDynamicToolOwner).GUID, "SIVsPackageDynamicToolOwner");
            }

            hr = serviceProvider.QueryService(typeof(SLicensedClassManager).GUID, typeof(ILicensedClassManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SLicensedClassManager).GUID, "SLicensedClassManager");
            }
            else
            {
                LogServiceError(hr, typeof(SLicensedClassManager).GUID, "SLicensedClassManager");
            }

            hr = serviceProvider.QueryService(typeof(SLocalRegistry).GUID, typeof(ILocalRegistry2).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SLocalRegistry).GUID, "SLocalRegistry");
            }
            else
            {
                LogServiceError(hr, typeof(SLocalRegistry).GUID, "SLocalRegistry");
            }

            hr = serviceProvider.QueryService(typeof(SOleComponentManager).GUID, typeof(IOleComponentManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SOleComponentManager).GUID, "SOleComponentManager");
            }
            else
            {
                LogServiceError(hr, typeof(SOleComponentManager).GUID, "SOleComponentManager");
            }

            hr = serviceProvider.QueryService(typeof(SOleComponentUIManager).GUID, typeof(IOleComponentUIManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SOleComponentUIManager).GUID, "SOleComponentUIManager");
            }
            else
            {
                LogServiceError(hr, typeof(SOleComponentUIManager).GUID, "SOleComponentUIManager");
            }

            hr = serviceProvider.QueryService(typeof(SOleInPlaceComponent).GUID, typeof(IOleInPlaceComponent).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SOleInPlaceComponent).GUID, "SOleInPlaceComponent");
            }
            else
            {
                LogServiceError(hr, typeof(SOleInPlaceComponent).GUID, "SOleInPlaceComponent");
            }

            hr = serviceProvider.QueryService(typeof(SOleInPlaceComponentSite).GUID, typeof(IOleInPlaceComponentSite).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SOleInPlaceComponentSite).GUID, "SOleInPlaceComponentSite");
            }
            else
            {
                LogServiceError(hr, typeof(SOleInPlaceComponentSite).GUID, "SOleInPlaceComponentSite");
            }

            hr = serviceProvider.QueryService(typeof(SOleUndoManager).GUID, typeof(IOleUndoManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SOleUndoManager).GUID, "SOleUndoManager");
            }
            else
            {
                LogServiceError(hr, typeof(SOleUndoManager).GUID, "SOleUndoManager");
            }

            hr = serviceProvider.QueryService(typeof(SProfferService).GUID, typeof(IProfferService).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SProfferService).GUID, "SProfferService");
            }
            else
            {
                LogServiceError(hr, typeof(SProfferService).GUID, "SProfferService");
            }

            hr = serviceProvider.QueryService(typeof(SProfferTypeLib).GUID, typeof(IProfferTypeLib).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SProfferTypeLib).GUID, "SProfferTypeLib");
            }
            else
            {
                LogServiceError(hr, typeof(SProfferTypeLib).GUID, "SProfferTypeLib");
            }

            hr = serviceProvider.QueryService(typeof(STrackSelection).GUID, typeof(ITrackSelection).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(STrackSelection).GUID, "STrackSelection");
            }
            else
            {
                LogServiceError(hr, typeof(STrackSelection).GUID, "STrackSelection");
            }

            hr = serviceProvider.QueryService(typeof(SUIHostCommandDispatcher).GUID, typeof(IOleCommandTarget).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SUIHostCommandDispatcher).GUID, "SUIHostCommandDispatcher");
            }
            else
            {
                LogServiceError(hr, typeof(SUIHostCommandDispatcher).GUID, "SUIHostCommandDispatcher");
            }

            hr = serviceProvider.QueryService(typeof(SUIHostLocale).GUID, typeof(IUIHostLocale).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SUIHostLocale).GUID, "SUIHostLocale");
            }
            else
            {
                LogServiceError(hr, typeof(SUIHostLocale).GUID, "SUIHostLocale");
            }

            hr = serviceProvider.QueryService(typeof(SVsActivityLog).GUID, typeof(IVsActivityLog).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsActivityLog).GUID, "SVsActivityLog");
            }
            else
            {
                LogServiceError(hr, typeof(SVsActivityLog).GUID, "SVsActivityLog");
            }

            hr = serviceProvider.QueryService(typeof(SVsAddProjectItemDlg).GUID, typeof(IVsAddProjectItemDlg).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsAddProjectItemDlg).GUID, "SVsAddProjectItemDlg");
            }
            else
            {
                LogServiceError(hr, typeof(SVsAddProjectItemDlg).GUID, "SVsAddProjectItemDlg");
            }

            hr = serviceProvider.QueryService(typeof(SVsAddWebReferenceDlg).GUID, typeof(IVsAddWebReferenceDlg).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsAddWebReferenceDlg).GUID, "SVsAddWebReferenceDlg");
            }
            else
            {
                LogServiceError(hr, typeof(SVsAddWebReferenceDlg).GUID, "SVsAddWebReferenceDlg");
            }

            hr = serviceProvider.QueryService(typeof(SVsAppCommandLine).GUID, typeof(IVsAppCommandLine).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsAppCommandLine).GUID, "SVsAppCommandLine");
            }
            else
            {
                LogServiceError(hr, typeof(SVsAppCommandLine).GUID, "SVsAppCommandLine");
            }

            hr = serviceProvider.QueryService(typeof(SVsCallBrowser).GUID, typeof(IVsCallBrowser).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsCallBrowser).GUID, "SVsCallBrowser");
            }
            else
            {
                LogServiceError(hr, typeof(SVsCallBrowser).GUID, "SVsCallBrowser");
            }

            hr = serviceProvider.QueryService(typeof(SVsClassView).GUID, typeof(IVsClassView).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsClassView).GUID, "SVsClassView");
            }
            else
            {
                LogServiceError(hr, typeof(SVsClassView).GUID, "SVsClassView");
            }

            hr = serviceProvider.QueryService(typeof(SVsCmdNameMapping).GUID, typeof(IVsCmdNameMapping).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsCmdNameMapping).GUID, "SVsCmdNameMapping");
            }
            else
            {
                LogServiceError(hr, typeof(SVsCmdNameMapping).GUID, "SVsCmdNameMapping");
            }

            hr = serviceProvider.QueryService(typeof(SVsCodeDefView).GUID, typeof(IVsCodeDefView).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsCodeDefView).GUID, "SVsCodeDefView");
            }
            else
            {
                LogServiceError(hr, typeof(SVsCodeDefView).GUID, "SVsCodeDefView");
            }

            hr = serviceProvider.QueryService(typeof(SVsCodeShareHandler).GUID, typeof(IVsCodeShareHandler).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsCodeShareHandler).GUID, "SVsCodeShareHandler");
            }
            else
            {
                LogServiceError(hr, typeof(SVsCodeShareHandler).GUID, "SVsCodeShareHandler");
            }

            hr = serviceProvider.QueryService(typeof(SVsCodeWindow).GUID, typeof(IVsCodeWindow).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsCodeWindow).GUID, "SVsCodeWindow");
            }
            else
            {
                LogServiceError(hr, typeof(SVsCodeWindow).GUID, "SVsCodeWindow");
            }

            hr = serviceProvider.QueryService(typeof(SVsCodeWindowManager).GUID, typeof(IVsCodeWindowManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsCodeWindowManager).GUID, "SVsCodeWindowManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsCodeWindowManager).GUID, "SVsCodeWindowManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsCommandWindow).GUID, typeof(IVsCommandWindow2).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsCommandWindow).GUID, "SVsCommandWindow");
            }
            else
            {
                LogServiceError(hr, typeof(SVsCommandWindow).GUID, "SVsCommandWindow");
            }

            hr = serviceProvider.QueryService(typeof(SVsCommandWindowsCollection).GUID, typeof(IVsCommandWindowsCollection).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsCommandWindowsCollection).GUID, "SVsCommandWindowsCollection");
            }
            else
            {
                LogServiceError(hr, typeof(SVsCommandWindowsCollection).GUID, "SVsCommandWindowsCollection");
            }

            hr = serviceProvider.QueryService(typeof(SVsComplusLibrary).GUID, typeof(IVsLibraryReferenceManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsComplusLibrary).GUID, "SVsComplusLibrary");
            }
            else
            {
                LogServiceError(hr, typeof(SVsComplusLibrary).GUID, "SVsComplusLibrary");
            }

            hr = serviceProvider.QueryService(typeof(SVsComponentSelectorDlg).GUID, typeof(IVsComponentSelectorDlg).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsComponentSelectorDlg).GUID, "SVsComponentSelectorDlg");
            }
            else
            {
                LogServiceError(hr, typeof(SVsComponentSelectorDlg).GUID, "SVsComponentSelectorDlg");
            }

            hr = serviceProvider.QueryService(typeof(SVsComponentSelectorDlg2).GUID, typeof(IVsComponentSelectorDlg2).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsComponentSelectorDlg2).GUID, "SVsComponentSelectorDlg2");
            }
            else
            {
                LogServiceError(hr, typeof(SVsComponentSelectorDlg2).GUID, "SVsComponentSelectorDlg2");
            }

            hr = serviceProvider.QueryService(typeof(SVsConfigurationManagerDlg).GUID, typeof(IVsConfigurationManagerDlg).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsConfigurationManagerDlg).GUID, "SVsConfigurationManagerDlg");
            }
            else
            {
                LogServiceError(hr, typeof(SVsConfigurationManagerDlg).GUID, "SVsConfigurationManagerDlg");
            }

            hr = serviceProvider.QueryService(typeof(SVsCreateAggregateProject).GUID, typeof(IVsCreateAggregateProject).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsCreateAggregateProject).GUID, "SVsCreateAggregateProject");
            }
            else
            {
                LogServiceError(hr, typeof(SVsCreateAggregateProject).GUID, "SVsCreateAggregateProject");
            }

            hr = serviceProvider.QueryService(typeof(SVsDebuggableProtocol).GUID, typeof(IVsDebuggableProtocol).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsDebuggableProtocol).GUID, "SVsDebuggableProtocol");
            }
            else
            {
                LogServiceError(hr, typeof(SVsDebuggableProtocol).GUID, "SVsDebuggableProtocol");
            }

            hr = serviceProvider.QueryService(typeof(SVsDebugLaunch).GUID, typeof(IVsDebugLaunch).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsDebugLaunch).GUID, "SVsDebugLaunch");
            }
            else
            {
                LogServiceError(hr, typeof(SVsDebugLaunch).GUID, "SVsDebugLaunch");
            }

            hr = serviceProvider.QueryService(typeof(SVsDiscoveryService).GUID, typeof(IVsDiscoveryService).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsDiscoveryService).GUID, "SVsDiscoveryService");
            }
            else
            {
                LogServiceError(hr, typeof(SVsDiscoveryService).GUID, "SVsDiscoveryService");
            }

            hr = serviceProvider.QueryService(typeof(SVsEnumHierarchyItemsFactory).GUID, typeof(IVsEnumHierarchyItemsFactory).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsEnumHierarchyItemsFactory).GUID, "SVsEnumHierarchyItemsFactory");
            }
            else
            {
                LogServiceError(hr, typeof(SVsEnumHierarchyItemsFactory).GUID, "SVsEnumHierarchyItemsFactory");
            }

            hr = serviceProvider.QueryService(typeof(SVsErrorList).GUID, typeof(IVsErrorList).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsErrorList).GUID, "SVsErrorList");
            }
            else
            {
                LogServiceError(hr, typeof(SVsErrorList).GUID, "SVsErrorList");
            }

            hr = serviceProvider.QueryService(typeof(SVsExternalFilesManager).GUID, typeof(IVsExternalFilesManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsExternalFilesManager).GUID, "SVsExternalFilesManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsExternalFilesManager).GUID, "SVsExternalFilesManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsFileChangeEx).GUID, typeof(IVsFileChangeEx).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsFileChangeEx).GUID, "SVsFileChangeEx");
            }
            else
            {
                LogServiceError(hr, typeof(SVsFileChangeEx).GUID, "SVsFileChangeEx");
            }

            hr = serviceProvider.QueryService(typeof(SVsFilterAddProjectItemDlg).GUID, typeof(IVsFilterAddProjectItemDlg).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsFilterAddProjectItemDlg).GUID, "SVsFilterAddProjectItemDlg");
            }
            else
            {
                LogServiceError(hr, typeof(SVsFilterAddProjectItemDlg).GUID, "SVsFilterAddProjectItemDlg");
            }

            hr = serviceProvider.QueryService(typeof(SVsFilterKeys).GUID, typeof(IVsFilterKeys).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsFilterKeys).GUID, "SVsFilterKeys");
            }
            else
            {
                LogServiceError(hr, typeof(SVsFilterKeys).GUID, "SVsFilterKeys");
            }

            hr = serviceProvider.QueryService(typeof(SVsFontAndColorCacheManager).GUID, typeof(IVsFontAndColorCacheManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsFontAndColorCacheManager).GUID, "SVsFontAndColorCacheManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsFontAndColorCacheManager).GUID, "SVsFontAndColorCacheManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsFontAndColorStorage).GUID, typeof(IVsFontAndColorStorage).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsFontAndColorStorage).GUID, "SVsFontAndColorStorage");
            }
            else
            {
                LogServiceError(hr, typeof(SVsFontAndColorStorage).GUID, "SVsFontAndColorStorage");
            }

            hr = serviceProvider.QueryService(typeof(SVsGeneralOutputWindowPane).GUID, typeof(IVsOutputWindowPane).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsGeneralOutputWindowPane).GUID, "SVsGeneralOutputWindowPane");
            }
            else
            {
                LogServiceError(hr, typeof(SVsGeneralOutputWindowPane).GUID, "SVsGeneralOutputWindowPane");
            }

            hr = serviceProvider.QueryService(typeof(SVsHelpService).GUID, typeof(IVsHelpSystem).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsHelpService).GUID, "SVsHelpService");
            }
            else
            {
                LogServiceError(hr, typeof(SVsHelpService).GUID, "SVsHelpService");
            }

            hr = serviceProvider.QueryService(typeof(SVsHTMLConverter).GUID, typeof(IVsHTMLConverter).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsHTMLConverter).GUID, "SVsHTMLConverter");
            }
            else
            {
                LogServiceError(hr, typeof(SVsHTMLConverter).GUID, "SVsHTMLConverter");
            }

            hr = serviceProvider.QueryService(typeof(SVsIME).GUID, typeof(IVsIME).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsIME).GUID, "SVsIME");
            }
            else
            {
                LogServiceError(hr, typeof(SVsIME).GUID, "SVsIME");
            }

            hr = serviceProvider.QueryService(typeof(SVsIntegratedHelp).GUID, typeof(SVsHelp).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsIntegratedHelp).GUID, "SVsIntegratedHelp");
            }
            else
            {
                LogServiceError(hr, typeof(SVsIntegratedHelp).GUID, "SVsIntegratedHelp");
            }

            hr = serviceProvider.QueryService(typeof(SVsIntelliMouseHandler).GUID, typeof(IVsIntelliMouseHandler).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsIntelliMouseHandler).GUID, "SVsIntelliMouseHandler");
            }
            else
            {
                LogServiceError(hr, typeof(SVsIntelliMouseHandler).GUID, "SVsIntelliMouseHandler");
            }

            hr = serviceProvider.QueryService(typeof(SVsIntellisenseEngine).GUID, typeof(IVsIntellisenseEngine).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsIntellisenseEngine).GUID, "SVsIntellisenseEngine");
            }
            else
            {
                LogServiceError(hr, typeof(SVsIntellisenseEngine).GUID, "SVsIntellisenseEngine");
            }

            hr = serviceProvider.QueryService(typeof(SVsIntellisenseProjectHost).GUID, typeof(IVsIntellisenseProjectHost).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsIntellisenseProjectHost).GUID, "SVsIntellisenseProjectHost");
            }
            else
            {
                LogServiceError(hr, typeof(SVsIntellisenseProjectHost).GUID, "SVsIntellisenseProjectHost");
            }

            hr = serviceProvider.QueryService(typeof(SVsIntellisenseProjectManager).GUID, typeof(IVsIntellisenseProjectManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsIntellisenseProjectManager).GUID, "SVsIntellisenseProjectManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsIntellisenseProjectManager).GUID, "SVsIntellisenseProjectManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsInvisibleEditorManager).GUID, typeof(IVsInvisibleEditorManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsInvisibleEditorManager).GUID, "SVsInvisibleEditorManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsInvisibleEditorManager).GUID, "SVsInvisibleEditorManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsLanguageFilter).GUID, typeof(IVsTextViewFilter).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsLanguageFilter).GUID, "SVsLanguageFilter");
            }
            else
            {
                LogServiceError(hr, typeof(SVsLanguageFilter).GUID, "SVsLanguageFilter");
            }

            hr = serviceProvider.QueryService(typeof(SVsLaunchPad).GUID, typeof(IVsLaunchPad).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsLaunchPad).GUID, "SVsLaunchPad");
            }
            else
            {
                LogServiceError(hr, typeof(SVsLaunchPad).GUID, "SVsLaunchPad");
            }

            hr = serviceProvider.QueryService(typeof(SVsLaunchPadFactory).GUID, typeof(IVsLaunchPadFactory).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsLaunchPadFactory).GUID, "SVsLaunchPadFactory");
            }
            else
            {
                LogServiceError(hr, typeof(SVsLaunchPadFactory).GUID, "SVsLaunchPadFactory");
            }

            hr = serviceProvider.QueryService(typeof(SVsLinkedUndoTransactionManager).GUID, typeof(IVsLinkedUndoTransactionManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsLinkedUndoTransactionManager).GUID, "SVsLinkedUndoTransactionManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsLinkedUndoTransactionManager).GUID, "SVsLinkedUndoTransactionManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsMenuEditor).GUID, typeof(IVsMenuEditorFactory).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsMenuEditor).GUID, "SVsMenuEditor");
            }
            else
            {
                LogServiceError(hr, typeof(SVsMenuEditor).GUID, "SVsMenuEditor");
            }

            hr = serviceProvider.QueryService(typeof(SVsMonitorUserContext).GUID, typeof(IVsMonitorUserContext).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsMonitorUserContext).GUID, "SVsMonitorUserContext");
            }
            else
            {
                LogServiceError(hr, typeof(SVsMonitorUserContext).GUID, "SVsMonitorUserContext");
            }

            hr = serviceProvider.QueryService(typeof(SVsObjBrowser).GUID, typeof(IVsObjBrowser).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsObjBrowser).GUID, "SVsObjBrowser");
            }
            else
            {
                LogServiceError(hr, typeof(SVsObjBrowser).GUID, "SVsObjBrowser");
            }

            hr = serviceProvider.QueryService(typeof(SVsObjectManager).GUID, typeof(IVsObjectManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsObjectManager).GUID, "SVsObjectManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsObjectManager).GUID, "SVsObjectManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsObjectSearch).GUID, typeof(IVsObjectSearch).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsObjectSearch).GUID, "SVsObjectSearch");
            }
            else
            {
                LogServiceError(hr, typeof(SVsObjectSearch).GUID, "SVsObjectSearch");
            }

            hr = serviceProvider.QueryService(typeof(SVsOpenProjectOrSolutionDlg).GUID, typeof(IVsOpenProjectOrSolutionDlg).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsOpenProjectOrSolutionDlg).GUID, "SVsOpenProjectOrSolutionDlg");
            }
            else
            {
                LogServiceError(hr, typeof(SVsOpenProjectOrSolutionDlg).GUID, "SVsOpenProjectOrSolutionDlg");
            }

            hr = serviceProvider.QueryService(typeof(SVsOutputWindow).GUID, typeof(IVsOutputWindow).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsOutputWindow).GUID, "SVsOutputWindow");
            }
            else
            {
                LogServiceError(hr, typeof(SVsOutputWindow).GUID, "SVsOutputWindow");
            }

            hr = serviceProvider.QueryService(typeof(SVsParseCommandLine).GUID, typeof(IVsParseCommandLine).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsParseCommandLine).GUID, "SVsParseCommandLine");
            }
            else
            {
                LogServiceError(hr, typeof(SVsParseCommandLine).GUID, "SVsParseCommandLine");
            }

            hr = serviceProvider.QueryService(typeof(SVsPathVariableResolver).GUID, typeof(IVsPathVariableResolver).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsPathVariableResolver).GUID, "SVsPathVariableResolver");
            }
            else
            {
                LogServiceError(hr, typeof(SVsPathVariableResolver).GUID, "SVsPathVariableResolver");
            }

            hr = serviceProvider.QueryService(typeof(SVsPreviewChangesService).GUID, typeof(IVsPreviewChangesService).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsPreviewChangesService).GUID, "SVsPreviewChangesService");
            }
            else
            {
                LogServiceError(hr, typeof(SVsPreviewChangesService).GUID, "SVsPreviewChangesService");
            }

            hr = serviceProvider.QueryService(typeof(SVsProfileDataManager).GUID, typeof(IVsProfileDataManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsProfileDataManager).GUID, "SVsProfileDataManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsProfileDataManager).GUID, "SVsProfileDataManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsProfilesManagerUI).GUID, typeof(IVsProfilesManagerUI).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsProfilesManagerUI).GUID, "SVsProfilesManagerUI");
            }
            else
            {
                LogServiceError(hr, typeof(SVsProfilesManagerUI).GUID, "SVsProfilesManagerUI");
            }

            hr = serviceProvider.QueryService(typeof(SVsPropertyPageFrame).GUID, typeof(IVsPropertyPageFrame).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsPropertyPageFrame).GUID, "SVsPropertyPageFrame");
            }
            else
            {
                LogServiceError(hr, typeof(SVsPropertyPageFrame).GUID, "SVsPropertyPageFrame");
            }

            hr = serviceProvider.QueryService(typeof(SVsQueryEditQuerySave).GUID, typeof(IVsQueryEditQuerySave2).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsQueryEditQuerySave).GUID, "SVsQueryEditQuerySave");
            }
            else
            {
                LogServiceError(hr, typeof(SVsQueryEditQuerySave).GUID, "SVsQueryEditQuerySave");
            }

            hr = serviceProvider.QueryService(typeof(SVsRegisterDebugTargetProvider).GUID, typeof(IVsRegisterProjectDebugTargetProvider).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsRegisterDebugTargetProvider).GUID, "SVsRegisterDebugTargetProvider");
            }
            else
            {
                LogServiceError(hr, typeof(SVsRegisterDebugTargetProvider).GUID, "SVsRegisterDebugTargetProvider");
            }

            hr = serviceProvider.QueryService(typeof(SVsRegisterEditors).GUID, typeof(IVsRegisterEditors).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsRegisterEditors).GUID, "SVsRegisterEditors");
            }
            else
            {
                LogServiceError(hr, typeof(SVsRegisterEditors).GUID, "SVsRegisterEditors");
            }

            hr = serviceProvider.QueryService(typeof(SVsRegisterFindScope).GUID, typeof(IVsRegisterFindScope).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsRegisterFindScope).GUID, "SVsRegisterFindScope");
            }
            else
            {
                LogServiceError(hr, typeof(SVsRegisterFindScope).GUID, "SVsRegisterFindScope");
            }

            hr = serviceProvider.QueryService(typeof(SVsRegisterPriorityCommandTarget).GUID, typeof(IVsRegisterPriorityCommandTarget).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsRegisterPriorityCommandTarget).GUID, "SVsRegisterPriorityCommandTarget");
            }
            else
            {
                LogServiceError(hr, typeof(SVsRegisterPriorityCommandTarget).GUID, "SVsRegisterPriorityCommandTarget");
            }

            hr = serviceProvider.QueryService(typeof(SVsRegisterProjectTypes).GUID, typeof(IVsRegisterProjectTypes).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsRegisterProjectTypes).GUID, "SVsRegisterProjectTypes");
            }
            else
            {
                LogServiceError(hr, typeof(SVsRegisterProjectTypes).GUID, "SVsRegisterProjectTypes");
            }

            hr = serviceProvider.QueryService(typeof(SVsResourceManager).GUID, typeof(IVsResourceManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsResourceManager).GUID, "SVsResourceManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsResourceManager).GUID, "SVsResourceManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsResourceView).GUID, typeof(IVsResourceView).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsResourceView).GUID, "SVsResourceView");
            }
            else
            {
                LogServiceError(hr, typeof(SVsResourceView).GUID, "SVsResourceView");
            }

            hr = serviceProvider.QueryService(typeof(SVsRunningDocumentTable).GUID, typeof(IVsRunningDocumentTable).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsRunningDocumentTable).GUID, "SVsRunningDocumentTable");
            }
            else
            {
                LogServiceError(hr, typeof(SVsRunningDocumentTable).GUID, "SVsRunningDocumentTable");
            }

            hr = serviceProvider.QueryService(typeof(SVsSccManager).GUID, typeof(IVsSccManager2).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsSccManager).GUID, "SVsSccManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsSccManager).GUID, "SVsSccManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsSccToolsOptions).GUID, typeof(IVsSccToolsOptions).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsSccToolsOptions).GUID, "SVsSccToolsOptions");
            }
            else
            {
                LogServiceError(hr, typeof(SVsSccToolsOptions).GUID, "SVsSccToolsOptions");
            }

            hr = serviceProvider.QueryService(typeof(SVsSettingsReader).GUID, typeof(IVsSettingsReader).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsSettingsReader).GUID, "SVsSettingsReader");
            }
            else
            {
                LogServiceError(hr, typeof(SVsSettingsReader).GUID, "SVsSettingsReader");
            }

            hr = serviceProvider.QueryService(typeof(SVsShell).GUID, typeof(IVsShell).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsShell).GUID, "SVsShell");
            }
            else
            {
                LogServiceError(hr, typeof(SVsShell).GUID, "SVsShell");
            }

            hr = serviceProvider.QueryService(typeof(SVsShellDebugger).GUID, typeof(IVsDebugger).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsShellDebugger).GUID, "SVsShellDebugger");
            }
            else
            {
                LogServiceError(hr, typeof(SVsShellDebugger).GUID, "SVsShellDebugger");
            }

            hr = serviceProvider.QueryService(typeof(SVsShellMonitorSelection).GUID, typeof(IVsMonitorSelection).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsShellMonitorSelection).GUID, "SVsShellMonitorSelection");
            }
            else
            {
                LogServiceError(hr, typeof(SVsShellMonitorSelection).GUID, "SVsShellMonitorSelection");
            }

            hr = serviceProvider.QueryService(typeof(SVSMDCodeDomProvider).GUID, typeof(IVSMDCodeDomProvider).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVSMDCodeDomProvider).GUID, "SVSMDCodeDomProvider");
            }
            else
            {
                LogServiceError(hr, typeof(SVSMDCodeDomProvider).GUID, "SVSMDCodeDomProvider");
            }

            hr = serviceProvider.QueryService(typeof(SVSMDDesignerService).GUID, typeof(IVSMDDesignerService).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVSMDDesignerService).GUID, "SVSMDDesignerService");
            }
            else
            {
                LogServiceError(hr, typeof(SVSMDDesignerService).GUID, "SVSMDDesignerService");
            }

            hr = serviceProvider.QueryService(typeof(SVSMDPropertyBrowser).GUID, typeof(IVSMDPropertyBrowser).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVSMDPropertyBrowser).GUID, "SVSMDPropertyBrowser");
            }
            else
            {
                LogServiceError(hr, typeof(SVSMDPropertyBrowser).GUID, "SVSMDPropertyBrowser");
            }

            hr = serviceProvider.QueryService(typeof(SVSMDTypeResolutionService).GUID, typeof(IVSMDTypeResolutionService).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVSMDTypeResolutionService).GUID, "SVSMDTypeResolutionService");
            }
            else
            {
                LogServiceError(hr, typeof(SVSMDTypeResolutionService).GUID, "SVSMDTypeResolutionService");
            }

            hr = serviceProvider.QueryService(typeof(SVsSmartOpenScope).GUID, typeof(IVsSmartOpenScope).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsSmartOpenScope).GUID, "SVsSmartOpenScope");
            }
            else
            {
                LogServiceError(hr, typeof(SVsSmartOpenScope).GUID, "SVsSmartOpenScope");
            }

            hr = serviceProvider.QueryService(typeof(SVsSolution).GUID, typeof(IVsSolution).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsSolution).GUID, "SVsSolution");
            }
            else
            {
                LogServiceError(hr, typeof(SVsSolution).GUID, "SVsSolution");
            }

            hr = serviceProvider.QueryService(typeof(SVsSolutionBuildManager).GUID, typeof(IVsSolutionBuildManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsSolutionBuildManager).GUID, "SVsSolutionBuildManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsSolutionBuildManager).GUID, "SVsSolutionBuildManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsSolutionObject).GUID, typeof(IVsSolution).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsSolutionObject).GUID, "SVsSolutionObject");
            }
            else
            {
                LogServiceError(hr, typeof(SVsSolutionObject).GUID, "SVsSolutionObject");
            }

            hr = serviceProvider.QueryService(typeof(SVsSolutionPersistence).GUID, typeof(IVsSolutionPersistence).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsSolutionPersistence).GUID, "SVsSolutionPersistence");
            }
            else
            {
                LogServiceError(hr, typeof(SVsSolutionPersistence).GUID, "SVsSolutionPersistence");
            }

            hr = serviceProvider.QueryService(typeof(SVsSQLCLRReferences).GUID, typeof(IVsSQLCLRReferences).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsSQLCLRReferences).GUID, "SVsSQLCLRReferences");
            }
            else
            {
                LogServiceError(hr, typeof(SVsSQLCLRReferences).GUID, "SVsSQLCLRReferences");
            }

            hr = serviceProvider.QueryService(typeof(SVsStartPageDownload).GUID, typeof(IVsStartPageDownload).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsStartPageDownload).GUID, "SVsStartPageDownload");
            }
            else
            {
                LogServiceError(hr, typeof(SVsStartPageDownload).GUID, "SVsStartPageDownload");
            }

            hr = serviceProvider.QueryService(typeof(SVsStatusbar).GUID, typeof(IVsStatusbar).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsStatusbar).GUID, "SVsStatusbar");
            }
            else
            {
                LogServiceError(hr, typeof(SVsStatusbar).GUID, "SVsStatusbar");
            }

            hr = serviceProvider.QueryService(typeof(SVsStrongNameKeys).GUID, typeof(IVsStrongNameKeys).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsStrongNameKeys).GUID, "SVsStrongNameKeys");
            }
            else
            {
                LogServiceError(hr, typeof(SVsStrongNameKeys).GUID, "SVsStrongNameKeys");
            }

            hr = serviceProvider.QueryService(typeof(SVsStructuredFileIO).GUID, typeof(IVsStructuredFileIO).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsStructuredFileIO).GUID, "SVsStructuredFileIO");
            }
            else
            {
                LogServiceError(hr, typeof(SVsStructuredFileIO).GUID, "SVsStructuredFileIO");
            }

            hr = serviceProvider.QueryService(typeof(SVsTaskList).GUID, typeof(IVsTaskList).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsTaskList).GUID, "SVsTaskList");
            }
            else
            {
                LogServiceError(hr, typeof(SVsTaskList).GUID, "SVsTaskList");
            }

            hr = serviceProvider.QueryService(typeof(SVsTextImageUtilities).GUID, typeof(IVsTextImageUtilities).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsTextImageUtilities).GUID, "SVsTextImageUtilities");
            }
            else
            {
                LogServiceError(hr, typeof(SVsTextImageUtilities).GUID, "SVsTextImageUtilities");
            }

            hr = serviceProvider.QueryService(typeof(SVsTextManager).GUID, typeof(IVsTextManager).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsTextManager).GUID, "SVsTextManager");
            }
            else
            {
                LogServiceError(hr, typeof(SVsTextManager).GUID, "SVsTextManager");
            }

            hr = serviceProvider.QueryService(typeof(SVsTextOut).GUID, typeof(IVsTextOut).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsTextOut).GUID, "SVsTextOut");
            }
            else
            {
                LogServiceError(hr, typeof(SVsTextOut).GUID, "SVsTextOut");
            }

            hr = serviceProvider.QueryService(typeof(SVsTextSpanSet).GUID, typeof(IVsTextSpanSet).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsTextSpanSet).GUID, "SVsTextSpanSet");
            }
            else
            {
                LogServiceError(hr, typeof(SVsTextSpanSet).GUID, "SVsTextSpanSet");
            }

            hr = serviceProvider.QueryService(typeof(SVsThreadedWaitDialog).GUID, typeof(IVsThreadedWaitDialog).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsThreadedWaitDialog).GUID, "SVsThreadedWaitDialog");
            }
            else
            {
                LogServiceError(hr, typeof(SVsThreadedWaitDialog).GUID, "SVsThreadedWaitDialog");
            }

            hr = serviceProvider.QueryService(typeof(SVsThreadPool).GUID, typeof(IVsThreadPool).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsThreadPool).GUID, "SVsThreadPool");
            }
            else
            {
                LogServiceError(hr, typeof(SVsThreadPool).GUID, "SVsThreadPool");
            }

            hr = serviceProvider.QueryService(typeof(SVsToolbox).GUID, typeof(IVsToolbox).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsToolbox).GUID, "SVsToolbox");
            }
            else
            {
                LogServiceError(hr, typeof(SVsToolbox).GUID, "SVsToolbox");
            }

            hr = serviceProvider.QueryService(typeof(SVsToolboxActiveXDataProvider).GUID, typeof(IVsToolboxDataProvider).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsToolboxActiveXDataProvider).GUID, "SVsToolboxActiveXDataProvider");
            }
            else
            {
                LogServiceError(hr, typeof(SVsToolboxActiveXDataProvider).GUID, "SVsToolboxActiveXDataProvider");
            }

            hr = serviceProvider.QueryService(typeof(SVsToolboxDataProviderRegistry).GUID, typeof(IVsToolboxDataProviderRegistry).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsToolboxDataProviderRegistry).GUID, "SVsToolboxDataProviderRegistry");
            }
            else
            {
                LogServiceError(hr, typeof(SVsToolboxDataProviderRegistry).GUID, "SVsToolboxDataProviderRegistry");
            }

            hr = serviceProvider.QueryService(typeof(SVsToolsOptions).GUID, typeof(IVsToolsOptions).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsToolsOptions).GUID, "SVsToolsOptions");
            }
            else
            {
                LogServiceError(hr, typeof(SVsToolsOptions).GUID, "SVsToolsOptions");
            }

            hr = serviceProvider.QueryService(typeof(SVsTrackProjectDocuments).GUID, typeof(IVsTrackProjectDocuments3).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsTrackProjectDocuments).GUID, "SVsTrackProjectDocuments");
            }
            else
            {
                LogServiceError(hr, typeof(SVsTrackProjectDocuments).GUID, "SVsTrackProjectDocuments");
            }

            hr = serviceProvider.QueryService(typeof(SVsTrackSelectionEx).GUID, typeof(IVsTrackSelectionEx).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsTrackSelectionEx).GUID, "SVsTrackSelectionEx");
            }
            else
            {
                LogServiceError(hr, typeof(SVsTrackSelectionEx).GUID, "SVsTrackSelectionEx");
            }

            hr = serviceProvider.QueryService(typeof(SVsUIHierWinClipboardHelper).GUID, typeof(IVsUIHierWinClipboardHelper).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsUIHierWinClipboardHelper).GUID, "SVsUIHierWinClipboardHelper");
            }
            else
            {
                LogServiceError(hr, typeof(SVsUIHierWinClipboardHelper).GUID, "SVsUIHierWinClipboardHelper");
            }

            hr = serviceProvider.QueryService(typeof(SVsUIShell).GUID, typeof(IVsUIShell).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsUIShell).GUID, "SVsUIShell");
            }
            else
            {
                LogServiceError(hr, typeof(SVsUIShell).GUID, "SVsUIShell");
            }

            hr = serviceProvider.QueryService(typeof(SVsUIShellDocumentWindowMgr).GUID, typeof(IVsUIShellDocumentWindowMgr).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsUIShellDocumentWindowMgr).GUID, "SVsUIShellDocumentWindowMgr");
            }
            else
            {
                LogServiceError(hr, typeof(SVsUIShellDocumentWindowMgr).GUID, "SVsUIShellDocumentWindowMgr");
            }

            hr = serviceProvider.QueryService(typeof(SVsUIShellOpenDocument).GUID, typeof(IVsUIShellOpenDocument).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsUIShellOpenDocument).GUID, "SVsUIShellOpenDocument");
            }
            else
            {
                LogServiceError(hr, typeof(SVsUIShellOpenDocument).GUID, "SVsUIShellOpenDocument");
            }

            hr = serviceProvider.QueryService(typeof(SVsUpgradeLogger).GUID, typeof(IVsUpgradeLogger).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsUpgradeLogger).GUID, "SVsUpgradeLogger");
            }
            else
            {
                LogServiceError(hr, typeof(SVsUpgradeLogger).GUID, "SVsUpgradeLogger");
            }

            hr = serviceProvider.QueryService(typeof(SVsWebBrowsingService).GUID, typeof(IVsWebBrowsingService).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsWebBrowsingService).GUID, "SVsWebBrowsingService");
            }
            else
            {
                LogServiceError(hr, typeof(SVsWebBrowsingService).GUID, "SVsWebBrowsingService");
            }

            hr = serviceProvider.QueryService(typeof(SVsWebFavorites).GUID, typeof(IVsWebFavorites).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsWebFavorites).GUID, "SVsWebFavorites");
            }
            else
            {
                LogServiceError(hr, typeof(SVsWebFavorites).GUID, "SVsWebFavorites");
            }

            hr = serviceProvider.QueryService(typeof(SVsWebPreview).GUID, typeof(IVsWebPreview).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsWebPreview).GUID, "SVsWebPreview");
            }
            else
            {
                LogServiceError(hr, typeof(SVsWebPreview).GUID, "SVsWebPreview");
            }

            hr = serviceProvider.QueryService(typeof(SVsWebURLMRU).GUID, typeof(IVsWebURLMRU).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsWebURLMRU).GUID, "SVsWebURLMRU");
            }
            else
            {
                LogServiceError(hr, typeof(SVsWebURLMRU).GUID, "SVsWebURLMRU");
            }

            hr = serviceProvider.QueryService(typeof(SVsWindowFrame).GUID, typeof(IVsWindowFrame).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsWindowFrame).GUID, "SVsWindowFrame");
            }
            else
            {
                LogServiceError(hr, typeof(SVsWindowFrame).GUID, "SVsWindowFrame");
            }

            hr = serviceProvider.QueryService(typeof(SVsXMLMemberIndexService).GUID, typeof(IVsXMLMemberIndexService).GUID, out pUnk);

            if (hr == VSConstants.S_OK)
            {
                LogServiceInfo(pUnk, typeof(SVsXMLMemberIndexService).GUID, "SVsXMLMemberIndexService");
            }
            else
            {
                LogServiceError(hr, typeof(SVsXMLMemberIndexService).GUID, "SVsXMLMemberIndexService");
            }

            #endregion
        }
    }
}
